/**
 * 定义list模块
 */

define(['jquery', 'common'], function($, common) {
	
	var list = {
		
		init: function() {
			this.render();
			this.bindEvent();
		},
		
		bindEvent: function() {
			$('#list').on('click', 'li', function() {
				// 获取点击的li的下标
				var index = $(this).index();
				location.href = 'detail.html?index=' + index;
			})
		},
		
		render: function() {
			var htmlStr = '';
			for (var i=0;i<5;i++) {
				htmlStr += `<li>这是第 ${i+1} 个li元素</li>`;
			}
			$('#list').html(htmlStr);
		}
	}
	
	list.init();
	
})